/*-----------------------------------------------------------------------------
 * @file   hal_hrt.h
 * @brief  Interface for High-resolution timer
 * @author WLH<wanglehui8357@163.com> Copyright (C) 2021~2099.
 ----------------------------------------------------------------------------*/
#ifndef HAL_HRT_H
#define HAL_HRT_H

#include "globaldef.h"

BEGIN_DECLS

/*-----------------------------------------------------------------------------
 * public functions
-----------------------------------------------------------------------------*/
/**
 * @brief Initialise the High-resolution timer.
 */
void hal_hrt_init(void);
/**
 * @brief Fetch a never-wrapping absolute time value in us after system start
 * Measured from some arbitrary epoch shortly after system startup.
 * It should never wrap or go backwards.
 */
hrt_abstime hal_hrt_get_us(void);
/**
 * @brief Get elapsed time from then timestamp in us
 */
hrt_abstime hal_hrt_elapsed_us(const hrt_abstime then);
/**
 * @brief Get system timestamp in ms (Max~1193h)
 */
U32 hal_hrt_get_ms(void);
/**
 * @brief Get elapsed time from then timestamp in ms
 */
U32 hal_hrt_elapsed_ms(const U32 then);

END_DECLS

#endif //~HAL_HRT_H
